Class DNSServerProcessImpl

All Implemented Interfaces:
IPCObject, DNSServerProcess, Process

public class DNSServerProcessImpl extends ProcessImpl implements DNSServerProcess
Information provided by the PKI file:

    \class DnsServerProcess
    
    \brief DnsServerProcess is the process that stores DNS records and resolves domain names and hostnames into IP addresses.
    
    \example network().getDevice("Server0").getProcess("DnsServer")
    
Author:
Auto-generated
  • Constructor Details

  • Method Details

    • addIpAddress

      public boolean addIpAddress(String hostname, IPAddress ipAddress)
      Information provided by the PKI file:
      
          \brief Adds a DNS record with the specified hostname and IP address.
          
          \param hostname, the hostname of the DNS record.
          \param ipAddress, the IP address of the DNS record.
          
          \return bool, true if successful, otherwise false.
          
              
      Specified by:
      addIpAddress in interface DNSServerProcess
      Parameters:
      hostname - Takes in a parameter of hostname
      ipAddress - Takes in a parameter of ipAddress
      Returns:
      boolean Returns a boolean
    • removeIpAddress

      public void removeIpAddress(String hostname)
      Information provided by the PKI file:
      
          \brief Removes the DNS record with the associated hostname.
          
          \param hostname, the hostname of the DNS record of interest.
          
              
      Specified by:
      removeIpAddress in interface DNSServerProcess
      Parameters:
      hostname - Takes in a parameter of hostname
    • getEntryAt

      public Pair<String,IPAddress> getEntryAt(int index)
      Information provided by the PKI file:
      
          \Returns the hostname and IP address of the DNS record at the specified index.
          
          \param index, the DNS record index of interest.
          
          \return pair<string, ip>, the hostname and IP address of the DNS record at the specified index.
          
              
      Specified by:
      getEntryAt in interface DNSServerProcess
      Parameters:
      index - Takes in a parameter of index
      Returns:
      Pair<String, IPAddress> Returns a Pair<String, IPAddress>
    • getEntryCount

      public int getEntryCount()
      Information provided by the PKI file:
      
          \brief Returns the number of DNS records.
          
          \return int, the number of DNS records.
          
              
      Specified by:
      getEntryCount in interface DNSServerProcess
      Returns:
      int Returns a int
    • isValidName

      public boolean isValidName(String hostname)
      Information provided by the PKI file:
      
          \brief Returns true if the specified hostname is a valid name (non-special characters), otherwise false.
          
          \param hostname, the hostname of interest.
          
          \return bool, true if the specified hostname is a valid name (non-special characters), otherwise false.
          
              
      Specified by:
      isValidName in interface DNSServerProcess
      Parameters:
      hostname - Takes in a parameter of hostname
      Returns:
      boolean Returns a boolean
    • setEnable

      public void setEnable(boolean bEnable)
      Information provided by the PKI file:
      
          \brief Enables or disables the DNS server process.
          
          \param bEnable, true to enable the DNS server process, false to disable it.
          
              
      Specified by:
      setEnable in interface DNSServerProcess
      Parameters:
      bEnable - Takes in a parameter of bEnable
    • isEnabled

      public boolean isEnabled()
      Information provided by the PKI file:
      
          \brief Returns true if the DNS server process is enabled, otherwise false.
          
          \return bool, true if the DNS server process is enabled, otherwise false.
          
              
      Specified by:
      isEnabled in interface DNSServerProcess
      Returns:
      boolean Returns a boolean
    • setPortNumber

      public void setPortNumber(int num)
      Information provided by the PKI file:
      
          \brief Sets the port number of the DNS service.
          
          \param num, the port number to set the DNS service to.
          
              
      Specified by:
      setPortNumber in interface DNSServerProcess
      Parameters:
      num - Takes in a parameter of num
    • getPortNumber

      public int getPortNumber()
      Information provided by the PKI file:
      
          \brief Returns the port number of the DNS service.
          
          \return int, the port number of the DNS service.
          
              
      Specified by:
      getPortNumber in interface DNSServerProcess
      Returns:
      int Returns a int
    • isDomainNameExisted

      public boolean isDomainNameExisted(String domainName)
      Information provided by the PKI file:
      
          \brief Returns true if the specified domain name exists, otherwise false.
          
          \param domainName, the domain name of interest.
          
          \return bool, true if the specified domain name exists, otherwise false.
          
              
      Specified by:
      isDomainNameExisted in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      Returns:
      boolean Returns a boolean
    • getIpAddOfDomain

      public IPAddress getIpAddOfDomain(String domainName)
      Information provided by the PKI file:
      
          \brief Returns the IP address of the specified domain name.
          
          \param domainName, the domain name of interest.
          
          \return ip, the IP address of the specified domain name.
          
              
      Specified by:
      getIpAddOfDomain in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      Returns:
      IPAddress Returns a IPAddress
    • getARecordWithAddress

      public DNSRrA getARecordWithAddress(String domainName, IPAddress address)
      Information provided by the PKI file:
      
          \brief Returns the A resource record with the specified parameters.
          
          \param domainName, the domain name of the A resource record of interest.
          \param address, the address of the A resource record of interest.
          
          \return DnsRrA, the A resource record object with the specified parameters.
          
              
      Specified by:
      getARecordWithAddress in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      address - Takes in a parameter of address
      Returns:
      DNSRrA Returns a DNSRrA
    • getCNameRecordWithHostname

      public DNSRrCname getCNameRecordWithHostname(String domainName, String hostName)
      Information provided by the PKI file:
      
          \brief Returns the CNAME resource record with the specified parameters.
          
          \param domainName, the domain name of the CNAME resource record of interest.
          \param hostName, the hostname of the CNAME resource record of interest.
          
          \return DnsRrCname, the CNAME resource record object with the specified parameters.
          
              
      Specified by:
      getCNameRecordWithHostname in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      hostName - Takes in a parameter of hostName
      Returns:
      DNSRrCname Returns a DNSRrCname
    • getSOARecordWithMailbox

      public DNSRrSoa getSOARecordWithMailbox(String domainName, String mailbox)
      Information provided by the PKI file:
      
          \brief Returns the SOA resource record with the specified parameters.
          
          \param domainName, the domain name of the SOA resource record of interest.
          \param mailbox, the mailbox of the SOA resource record of interest.
          
          \return DnsRrSoa, the SOA resource record object with the specified parameters.
          
              
      Specified by:
      getSOARecordWithMailbox in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      mailbox - Takes in a parameter of mailbox
      Returns:
      DNSRrSoa Returns a DNSRrSoa
    • getNSRecordWithServerName

      public DNSRrNs getNSRecordWithServerName(String domainName, String serverName)
      Information provided by the PKI file:
      
          \brief Returns the NS resource record with the specified parameters.
          
          \param domainName, the domain name of the NS resource record of interest.
          \param serverName, the server name of the NS resource record of interest.
          
          \return DnsRrNs, the NS resource record object with the specified parameters.
          
              
      Specified by:
      getNSRecordWithServerName in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      serverName - Takes in a parameter of serverName
      Returns:
      DNSRrNs Returns a DNSRrNs
    • addARecordToNameServerDb

      public boolean addARecordToNameServerDb(String domainName, String address)
      Information provided by the PKI file:
      
          \brief Returns true if the A resource record was added successfully, otherwise false.
          
          \param domainName, the domain name for the A resource record.
          \param address, the address for the A resource record.
          
          \return bool, true if the A resource record was added successfully, otherwise false.
          
              
      Specified by:
      addARecordToNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      address - Takes in a parameter of address
      Returns:
      boolean Returns a boolean
    • addCNAMEToNameServerDb

      public boolean addCNAMEToNameServerDb(String domainName, String hostName)
      Information provided by the PKI file:
      
          \brief Returns true if the CNAME resource record was added successfully, otherwise false.
          
          \param domainName, the domain name for the CNAME resource record.
          \param hostName, the hostname for the CNAME resource record.
          
          \return bool, true if the CNAME resource record was added successfully, otherwise false.
          
              
      Specified by:
      addCNAMEToNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      hostName - Takes in a parameter of hostName
      Returns:
      boolean Returns a boolean
    • addSOAToNameServerDb

      public boolean addSOAToNameServerDb(String domainName, String serverName, String mailbox, String minTtl, String refresh, String retry, String expiry)
      Information provided by the PKI file:
      
          \brief Returns true if the SOA resource record was added successfully, otherwise false.
          
          \param domainName, the domain name for the SOA resource record.
          \param serverName, the primary server name for the SOA resource record.
          \param mailbox, the mailbox for the SOA resource record.
          \param minTtl, the minimum TTL for the SOA resource record.
          \param refresh, the refresh time for the SOA resource record.
          \param retry, the retry time for the SOA resource record.
          \param expiry, the expiry time for the SOA resource record.
          
          \return bool, true if the CNAME resource record was added successfully, otherwise false.
          
              
      Specified by:
      addSOAToNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      serverName - Takes in a parameter of serverName
      mailbox - Takes in a parameter of mailbox
      minTtl - Takes in a parameter of minTtl
      refresh - Takes in a parameter of refresh
      retry - Takes in a parameter of retry
      expiry - Takes in a parameter of expiry
      Returns:
      boolean Returns a boolean
    • addNSRecordToNameServerDb

      public boolean addNSRecordToNameServerDb(String domainName, String serverName)
      Information provided by the PKI file:
      
          \brief Returns true if the NS resource record was added successfully, otherwise false.
          
          \param domainName, the domain name for the NS resource record.
          \param serverName, the server name for the NS resource record.
          
          \return bool, true if the NS record was added successfully, otherwise false.
          
              
      Specified by:
      addNSRecordToNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      serverName - Takes in a parameter of serverName
      Returns:
      boolean Returns a boolean
    • removeARecordFromNameServerDb

      public boolean removeARecordFromNameServerDb(String domainName, String address)
      Information provided by the PKI file:
      
          \brief Returns true if the specified A resource record was removed successfully, otherwise false.
          
          \param domainName, the domain name of the A resource record of interest.
          \param address, the address of the A resource record of interest.
          
          \return bool, true if the specified A resource record was removed successfully, otherwise false.
          
              
      Specified by:
      removeARecordFromNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      address - Takes in a parameter of address
      Returns:
      boolean Returns a boolean
    • removeCNAMEFromNameServerDb

      public boolean removeCNAMEFromNameServerDb(String domainName, String hostName)
      Information provided by the PKI file:
      
          \brief Returns true if the specified CNAME resource record was removed successfully, otherwise false.
          
          \param domainName, the domain name of the CNAME resource record of interest.
          \param hostName, the hostname of the CNAME resource record of interest.
          
          \return bool, true if the specified CNAME resource record was removed successfully, otherwise false.
          
              
      Specified by:
      removeCNAMEFromNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      hostName - Takes in a parameter of hostName
      Returns:
      boolean Returns a boolean
    • removeSOAFromNameServerDb

      public boolean removeSOAFromNameServerDb(String domainName, String mailbox)
      Information provided by the PKI file:
      
          \brief Returns true if the specified SOA resource record was removed successfully, otherwise false.
          
          \param domainName, the domain name of the SOA resource record of interest.
          \param mailbox, the mailbox of the SOA resource record of interest.
          
          \return bool, true if the specified SOA resource record was removed successfully, otherwise false.
          
              
      Specified by:
      removeSOAFromNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      mailbox - Takes in a parameter of mailbox
      Returns:
      boolean Returns a boolean
    • removeNSRecordFromNameServerDb

      public boolean removeNSRecordFromNameServerDb(String domainName, String serverName)
      Information provided by the PKI file:
      
          \brief Returns true if the specified NS resource record was removed successfully, otherwise false.
          
          \param domainName, the domain name of the NS resource record of interest.
          \param serverName, the server name of the NS resource record of interest.
          
          \return bool, true if the specified NS resource record was removed successfully, otherwise false.
          
              
      Specified by:
      removeNSRecordFromNameServerDb in interface DNSServerProcess
      Parameters:
      domainName - Takes in a parameter of domainName
      serverName - Takes in a parameter of serverName
      Returns:
      boolean Returns a boolean
    • getSizeOfNameServerDb

      public int getSizeOfNameServerDb()
      Information provided by the PKI file:
      
          \brief Returns the size of the name server database.
          
          \return int, the size of the name server database.
          
              
      Specified by:
      getSizeOfNameServerDb in interface DNSServerProcess
      Returns:
      int Returns a int
    • getRrFromNameServerDbAt

      public DNSResourceRecord getRrFromNameServerDbAt(int index)
      Information provided by the PKI file:
      
          \brief Returns the resource record at the specified index.
          
          \param index, the index of the resource record of interest.
          
          \return DnsResourceRecord, the resource record DnsResourceRecord object at the specified index.
          
              
      Specified by:
      getRrFromNameServerDbAt in interface DNSServerProcess
      Parameters:
      index - Takes in a parameter of index
      Returns:
      DNSResourceRecord Returns a DNSResourceRecord
    • getMatchingRRsFromCache

      public List<DNSResourceRecord> getMatchingRRsFromCache(String name)
      Information provided by the PKI file:
      
          \brief Returns the resource record associated with the resource record name.
          
          \param name, the name of the resource record of interest.
          
          \return DnsResourceRecord, the resource record DnsResourceRecord object associated with the resource record name.
          
              
      Specified by:
      getMatchingRRsFromCache in interface DNSServerProcess
      Parameters:
      name - Takes in a parameter of name
      Returns:
      List<DNSResourceRecord> Returns a List<DNSResourceRecord>